package com.hrms.controller.user;

import com.hrms.entity.Orders;
import com.hrms.http.ResponseResult;
import com.hrms.service.OrdersService;
import com.hrms.utils.EntityUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;

@Transactional
@RestController
@RequestMapping("/user/center/history")
public class UserHistoryController {
    // 用户入住历史

    @Autowired
    private OrdersService ordersService;

    @RequestMapping("/init")
    public ResponseResult<List<Map<String, Object>>> init(@RequestBody EntityUtil entity) {
        // 初始化
        Orders orders = new Orders();
        orders.setOrder_user_id(entity.getOrder_user_id());

        List<Map<String, Object>> list = ordersService.selectbyUser(orders);
        return new ResponseResult<>("SUCCESS", list);
    }
}
